#!/usr/bin/node

const log = console.log;

try{
  let buf1 = new Buffer(256);
  buf1[0] = 0;

  log(`buf1 length:${buf1.length}\n`);
  log(buf1);

  for(let i=0;i<buf1.length;i++){buf1[i] = i;}
  log(buf1);

  let buf2 = buf1.slice(250,256);
  log(buf2);

  buf2.fill(0);
  log('buf2:',buf2);
  log('buf2:',buf2.toJSON());

  let array = ['a',0xba,0xdf00,0x00,255,10];
  let buf3 = new Buffer(array);

  log('buf3:',buf3.length,buf3);

  let buf4 = new Buffer('hello world','utf8');
  log('buf4:',buf4.length,buf4);

  buf4.copy(buf3,0,0,buf3.length);
  log('buf3:',buf3.length,buf3);
}catch(e){
  console.error('something wrong!');
}


